﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Pilhas
{
    public class Labels : CommomFunctions.Labels
    {
        /// <summary>
        /// Creates the labels of the stack elements.
        /// </summary>
        /// <param name="gd">
        /// The grid to which the labels will be added.
        /// </param>
        /// <param name="numEllipses">
        /// Maximum number of elements in the stack. Thus, here it represents the number of labels.
        /// </param>
        public void createLabels(Grid gd, int numEllipses)
        {
            for (int i = 0; i < numEllipses; i++)
            {
                Label tempLabel = new Label();
                gd.Children.Add(tempLabel);
                labels.Add(tempLabel);
            }

            foreach (Label lbl in labels)
            {                
                lbl.Visibility = Visibility.Hidden;
                lbl.Foreground = Brushes.Black;
                lbl.VerticalAlignment = VerticalAlignment.Center;
                lbl.HorizontalAlignment = HorizontalAlignment.Center;
                lbl.MinHeight = 30;
                lbl.FontSize = 14.0;
                lbl.FontWeight = FontWeights.Heavy;

                Grid.SetRow(lbl, 2);
                Grid.SetColumn(lbl, 0);
                Grid.SetColumnSpan(lbl, 3);
            }

            for (int i = 0; i < numEllipses; i++)
            {
                ((Label)(labels[i])).Margin = new Thickness(100, (39 * (numEllipses - i - 1)), 50, (39 * i));
                ((Label)(labels[i])).Height = 16;
            }
        }
    }
}
